package org.itboys.core.controller.front;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.itboys.commons.CommonConstants;
import org.itboys.commons.ErrorException;
import org.itboys.core.common.ExceptionEnum;
import org.itboys.core.dto.order.SundayReProductOrderDto;
import org.itboys.core.service.mysql.front.SundayFrontReProductService;
import org.itboys.core.util.ResponseMessage;
import org.itboys.framework.spring.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Author：贾琦磊
 * @Date：2018/8/23
 * @Description：手机端退货
 */
@Controller
@RequestMapping("/sunday/mobile/reProduct")
@Api(value = "reProduct",description = "退货")
public class SundayFrontReProductController extends BaseController{
    @Autowired
    private SundayFrontReProductService reProductService;

    @RequestMapping(value = "/select",method = RequestMethod.POST)
    @ApiOperation(value = "获取库存列表")
    public void select(HttpServletRequest request, HttpServletResponse response
            ,@ApiParam(required = true,name="storeId",value = "仓库id")@RequestParam(value = "storeId")Long storeId
            ,@ApiParam(required = true, name = "pageSize", value = "分页参数。每页数量。默认20") @RequestParam(value = "pageSize") String pageSize
            ,@ApiParam(required = true, name = "pageNumber", value = "分页参数。第几页。默认1") @RequestParam(value = "pageNumber") String pageNumber
    )throws Exception{
        List<SundayReProductOrderDto> result=reProductService.select(request);
        ResponseMessage.success(result);
    }
    @RequestMapping(value = "/clear",method = RequestMethod.POST)
    @ApiOperation(value = "获取库存列表")
    public void select(HttpServletRequest request, HttpServletResponse response
            ,@ApiParam(required = true,name="storeId",value = "仓库id")@RequestParam(value = "storeId")Long storeId
    )throws Exception{
       reProductService.clear(storeId);
        ResponseMessage.success();
    }
}
